<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>登录</title>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/base.css" />
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/index.css" />
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/login.css" />
    <script type="text/javascript" src="__PUBLIC__/js/jquery-1.10.2.min.js"></script>
    <!--[if lte IE 8]>
	<style type="text/css">
			html,body{width:100%; height:100%; overflow:scroll}
			.section-btn{display:none;}
		</style>
	<![endif]-->
    
    <script type="text/javascript">
	    $(document).ready(function() {
	    	// 页面大小
	    	var screen_height = $(window).height();
            $('.login-main').css({
                'min-height' : screen_height,
            });
            $(window).resize(function(){
                var screen_height = $(window).height();
                $('.login-main').css({
                    'min-height' : screen_height,
                });
            });
            // 文本框获取焦点
	    	if ($("#login_username").val() == '') {
	            $('#login_username').focus();
	        } else {
	            $('#login_password').focus();
	        }
	        // enter键提交
	        document.onkeydown = function(e) {
	            var ev = document.all ? window.event : e;
	            if (ev.keyCode == 13) {
	                $('.login-btn').click(); //处理事件
	            }
	        }
	        // 提交按钮
	        $(".login-btn").click(function(e) {
	            e.preventDefault();
	            $(".error-sp").addClass("DN");
                $.ajax({
                    type:"POST", 
                    url:"<{:U('Home/Index/loginHandle')}>", 
                    data:$("#form").serialize(),
                    async: false,
                    success: function(data){
                        if(data.status==0)
                            $(".error-sp").text(data.info).removeClass("DN");
                        else
                            window.location = data.data;
                    }
                });
	        });
	    });
    </script>
</head>
<body>
    <div class="layout-main login-main" id="loginhtml!@#">
        <form class="formLogin" method="post" id="form">
            <div class="login-box">
                <div class="login-logo"></div>
                <div class="login-cont form-main">
                    <ul class="form-border">
                        <li class="border-li">
                            <span class="title-sp"><i class="iconG user-man"></i></span>
                            <span class="cont-sp"><input type="text" class="text-inp" name="j_username" id="login_username" maxlength="32" autocorrect="off" autocapitalize="off" placeholder="用户名" /></span>
                        </li>
                        <li class="border-li">
                            <span class="title-sp"><i class="iconG password"></i></span>
                            <span class="cont-sp"><input type="password" class="text-inp" name="j_password"  id="login_password" data-required="required" placeholder="密码" /></span>
                            <span class="error-sp DN"></span>
                        </li>
                        <li>
                            <span class="cont-sp"><input type="button" value="登录"  class="login-btn btn btn-blue"/></span>
                        </li>
                        <li class="link-li">
                            <a href="<{:U('Index/index')}>">返回首页</a><em>|</em>
                            <a href="<{:U('Index/register')}>">新用户注册</a><em>|</em>
                            <a href="#">忘记密码</a>
                        </li>
                        <li>
                            <p>建议使用Chrome浏览器以获得最佳体验</p>
                        </li>
                    </ul>
                </div>
            </div>
        </form>
    </div>
</body>
</html>
